package com.itheima.ssm.vo;

import com.itheima.ssm.utils.DateUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class Orders implements Serializable {
    private Integer id;

    private String orderNum;

    private Date orderTime;

    private String orderTimeStr;

    private String peopleCount;

    private String orderDesc;

    private String payType;

    private String payTypeStr;

    private String orderStatus;

    private String orderStatusStr;

    private String productId;

    private String memberId;

    private Product product;

    private List<Traveller> travellers;

    private static final long serialVersionUID = 1L;

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public List<Traveller> getTravellers() {
        return travellers;
    }

    public void setTravellers(List<Traveller> travellers) {
        this.travellers = travellers;
    }

    public String getOrderStatusStr() {
        if (orderStatus != null) {
            // 状态 0 关闭 1 开启
            if("0".equals(orderStatus))
                orderStatusStr="未支付";
            if("1".equals(orderStatus))
                orderStatusStr="开启";
        }
        return orderStatusStr;
    }

    public void setOrderStatusStr(String orderStatusStr) {
        this.orderStatusStr = orderStatusStr;
    }

    public String getOrderTimeStr() {
        if(orderTime!=null){
            orderTimeStr= DateUtils.date2String(orderTime,"yyyy-MM-dd HH:mm");
        }
        return orderTimeStr;
    }

    public void setOrderTimeStr(String orderTimeStr) {
        this.orderTimeStr = orderTimeStr;
    }

    public String getPayTypeStr() {
        //支付方式(0 支付宝 1 微信 2其它)
        if("0".equals(payType)){
            payTypeStr="支付宝";
        }else if("1".equals(payType)){
            payTypeStr="微信";
        }else if("2".equals(payType)){
            payTypeStr="其它";
        }
        return payTypeStr;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum == null ? null : orderNum.trim();
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getPeopleCount() {
        return peopleCount;
    }

    public void setPeopleCount(String peopleCount) {
        this.peopleCount = peopleCount == null ? null : peopleCount.trim();
    }

    public String getOrderDesc() {
        return orderDesc;
    }

    public void setOrderDesc(String orderDesc) {
        this.orderDesc = orderDesc == null ? null : orderDesc.trim();
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType == null ? null : payType.trim();
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus == null ? null : orderStatus.trim();
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId == null ? null : productId.trim();
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId == null ? null : memberId.trim();
    }


    @Override
    public String toString() {
        return "Orders{" +
                "id=" + id +
                ", orderNum='" + orderNum + '\'' +
                ", orderTime=" + orderTime +
                ", orderTimeStr='" + orderTimeStr + '\'' +
                ", peopleCount='" + peopleCount + '\'' +
                ", orderDesc='" + orderDesc + '\'' +
                ", payType='" + payType + '\'' +
                ", payTypeStr='" + payTypeStr + '\'' +
                ", orderStatus='" + orderStatus + '\'' +
                ", orderStatusStr='" + orderStatusStr + '\'' +
                ", productId='" + productId + '\'' +
                ", memberId='" + memberId + '\'' +
                ", product=" + product +
                ", travellers=" + travellers +
                '}';
    }
}